package com.yst.feign2.common;

import java.io.Serializable;

/**
 * 错误码定义类
 * 1000 - 9999 为系统错误码
 */
public enum ErrorCode implements Serializable {
    /**
     * 系统错误定义
     */
    NO_ERROR(200, "成功"),
    ERROR(500, "错误"),
    INTERNAL_SERVER_ERROR(500, "服务器错误,请联系管理员"),
    BAD_REQUEST(400, "参数有误"),
    SC_UNAUTHORIZED(401, "您的账号在其他设备登录，需要重新登录，请注意账号安全"),
    VERIFICATION_CODE_LOSE_EFFICACY(402, "web-验证码已失效"),
    NOT_FOUND(404, "路径不存在，请检查路径是否正确"),
    REPETITION(405, "记录重复"),
    NOT_PERMISSION(406, "没有权限，请联系管理员授权"),
    NOT_PERMISSION_ADD_ROLE_NOT_CREATE(407, "新增用户所选角色，不是本人创建"),
    ADMIN_NOT_DELETE(408, "系统管理员不能删除"),
    NOT_DELETE(409, "当前用户不能删除"),
    NOT_SYS_MENU_DELETE(410, "系统菜单，不能删除"),
    NOT_SYS_MENU_DELETE_SUBMENU(411, "请先删除子菜单或按钮"),
    ID_LOCK(412, "账号已被锁定,请联系管理员"),
    SCHEDULE_ERROR(413, "定时任务异常"),
    HTTP_REQUEST_METHOD_NOT_SUPPORTED(414, "请查看api注意get/post等提交方式"),
    CLASSIFICATION_CONTAINS_SUBCLASSES_NOT_DELETE(415, "对不起该分类下含有子分类，不允许删除"),
    OSS_ERROR(430, "OSS异常"),
    SERVICE_CALL_ERROR_USER(601, "调用USER服务异常"),
    SERVICE_CALL_ERROR_PRODUCT(602, "调用PRODUCT服务异常"),
    SERVICE_CALL_ERROR_ORDER(603, "调用ORDER服务异常"),
    SERVICE_CALL_ERROR_PAYMENT(604, "调用PAYMENT服务异常"),
    SERVICE_CALL_ERROR_MSG(605, "调用MSG服务异常"),
    SERVICE_CALL_ERROR_BILL(606, "调用BILL服务异常"),
    SERVICE_CALL_ERROR_FLOW(607, "调用FLOW服务异常"),

    UN_DISPATCHING_TELEPHONE_ERROR(701, "无调度电话"),
    NO_DISLIVERER_ROUTE_ERROR(702, "无该配送员配送路线或替补配送员申请时,获取定位code失败"),
    AUDIT_DATA_ERROR(703, "替补审核数据异常"),
    NO_DISLIVERERLIST_ERROR(704, "该代理无县级代理区域,显示数据为空"),
    NOTIFY_REPLACEMENT_TO_WAIT(777, "当前存在替补未收工,请相互联系"),
    DIS_ACCOUNT_STOP(778, "配送员账号已停用，请联系管理员!"),


    /**
     * 错误码定义类
     * 1000 - 9999 为模块错误码
     */
    SYSTEM_UNKNOWN_ERROR(1000, "系统未知错误."),
    REQUEST_PARAMS_INVALID(1001, "请求参数非法."),
    REQUEST_DECRYPT_FAIL(1002, "请求解密错误."),
    REQUEST_API_IS_NULL(1003, "请求接口为空"),
    REQUEST_NOT_AUTH(1004, "用户未登陆"),
    REQUEST_SIGN_INVALID(1005, "Sign校验失败"),
    REQUEST_PARAMS_NULL(1006, "请求参数为空."),
    REQUEST_PARAMS_ID_IS_NULL(1007, "id参数为空."),
    PROTOCOL_IS_NULL(1010, "Protocol为空."),
    SECRET_KEY_LENGTH_WRONG(1011, "密钥长度不对."),
    USER_NOT_EXIST(1012, "用户不存在"),
    USER_ALREADY_EXIST(1013, "用户已经存在"),
    PHONE_ALREADY_EXIST(1014, "用户手机号已注册"),
    USER_NEED_LOGIN(1015, "用户需要登陆"),
    USER_SECRET_EXPIRE(1016, "秘钥过期"),
    DATE_FORMAT_ERROR(1017, "日期格式转换错误"),
    LEJANE_APPID_IS_ABSENT(1018, "APP_ID[{}]不存在"),
    REQUEST_TOKEN_EXPIRED(1019, "请求token过期"),
    IMEI_IN_BLACKLIST(1020, "黑名单设备"),
    CREATE_TOKEN_ERROR(1021, "创建token失败"),
    ID_NOT_NULL(1022, "id不能为空"),
    NAME_PASSWORD_ERROR(1023, "账号或密码不正确"),
    TACK_ORDER_ERROR(1026, "接单时间已过"),
    SELECT_DATA_ERROR(1035, "查询数据错误"),
    ROLE_EXIST_ERROR(1036, "角色已存在"),
    ORDER_DATA_ERROR(1038, "订单新增出错，请联系开发人员"),
    UPDATE_FLAG_ERROR(1039, "订单状态更新失败，请联系开发人员"),
    UPDATE_ECARD_PWD_ERROR(1040, "两次输入密码不相等,请重新输入"),
    ECARD_FLAG_PWD_ERROR(1042, "该一卡通未印制，无法派发"),
    ECARD_MOBILE_ERROR(1043, "该手机已绑定一卡通账号，请勿重复绑定"),
    PHONE_SEND_VERIFYCODE_ERROR(1044, "验证码获取失败，请重新获取"),
    PHONE_VERIFYCODE_ERROR(1045, "验证码输入错误，请重新输入"),
    PHONE_VERIFYCODE_EXPIRED(1046, "验证码已过期"),
    MONEY_ERROR(1047, "输入金额错误"),
    ECARD_USERID_ERROR(1048, "该用户已绑定账号，不可重复绑定"),
    ECARD_ALI_ERROR(1051, "短信第三方接口错误"),
    MOBILE_PASSWORD_RESTALI_ERROR(1052, "密码重置失败"),
    BRAND_EXIST_ERROR(1053, "该商品品牌已存在"),
    WAREHOUSE_EXIST_ERROR(1054, "仓库名称/仓库编码重复或该区域已存在仓库，请确认"),
    WAREHOUSE_LOCATION_DEL_ERROR(1055, "该库位为使用状态，不允许删除"),
    INVITER_NOT_EXIST(1056, "该邀请人未注册"),
    IMG_COUNT_ERROR(1057, "超出规定上传数量"),
    BAR_CODE_REPEAT(1058, "条码重复，请检查商品是否已存在，自定义条码，请重新勾选生成新条码。"),
    INVENTORY_ERROR(1059, "库存不足，请确认"),
    USER_AREA_CODE_ERROR(1060, "请选择完整的用户地址"),
    BAR_CODE_IS_NULL(1061, "商品条码不能为空，请确认"),
    PRODUCT_SUBORDINATE(1062, "该skuId不能设置为当前skuId的下级"),
    DEL_LOCATION_ERROR(1063, "该库位存在商品，不允许删除"),
    IN_COUNT_ERROR(1064, "入库数量不能为小数"),
    PRODUCT_NOT_HAVE(1065, "该商品不存在"),
    SELECT_STOPFLAG_ERROR(1066, "该仓库为使用状态，不允许删除"),
    SELECT_INVENTORY_ERROR(1067, "该仓库内有库存，不允许删除"),
    DEL_WAREHOUSE_ERROR(1068, "已采购入库的仓库不可删除"),
    ADD_SKU_ERROR(1069, "已存在相同属性的sku商品"),
    UP_PRODUCT_ERROR(1070, "请先设置商品价格"),
    PRODUCT_SKU_ATTR_ERROR(1071, "SKU属性不能为空"),
    PRODUCT_EXIST_ERROR(1072, "商品名称重复"),
    EXCEL_IMPORT_ERROR(1073, "Excel有数据导入失败"),
    MSG_NOT_FIND(1074, "未查找到对应信息"),
    WITHDRAW_NOT_FOUND(1075, "未找到该账户可用于提现的建设银行账户"),
    WITHDRAW_FOUND(1076, "该用户已添加了可用于提现的建设银行账户"),
    WITHDRAW_NAME_FOUND(1077, "支付宝姓名,账户号码不能为空"),
    DATA_EXIST_ERROR(1078, "数据已存在"),
    NO_SET_PRICE(1079, "未设置价格，禁止上架"),
    IDEM_TOKEN_EXCEPTION(1080, "请勿重复操作，稍后再试"),
    LEVEL_NAME_REPETITION(1081, "此会员等级名称重复"),
    UPDATE_USER_DELETE_MEMBER(1082, "此等级已绑定用户，请修改用户等级后，再次删除"),
    INPUT_POSITIVE(1083, "收银机数量请输入正整数"),
    CASH_NUMBER_EXCEED(1083, "本次添加收银机编号超出限定值，请重新规定限定值"),
    CASH_BINDING_ERROR(1084, "收银机绑定错误"),
    CASH_FAULT_NO_SEND(1085, "收银机已损坏，禁止派发商家"),
    CASH_MAC_NO_DEL(1085, "收银机已绑定MAC地址禁止删除"),
    USER_NO_MR(1086, "该员工不是超市员工"),
    USER_lOCK(10087, "用户已停用"),
    ARRERCODE_ERROR(1089, "区划代码错误"),

    /**
     * 功能模块错误码定义
     * 10000 - 10099 用户模块错误码
     */
    USER_NOT_EXIST_ERROR(10001, "用户名密码错误"),
    USER_PASSWORD_ERROR(10002, "密码错误"),
    USER_MOBILE_REPETITION(10003, "手机号重复"),
    USER_OLD_PASSWORD_ERROR(10004, "原密码不正确"),
    MOBILE_OR_EMAIL_ERROR(10005, "手机号或邮箱错误"),
    NAME_IS_EXIST(10006, "用户名已存在"),
    PERMISSIONS_NOT_FIND(10007, "权限未找到"),
    REGION_IS_EXIST(10008, "大区已存在"),
    PARALLELISM_REGION_NOT_FIND(10009, "未找到对应的大区"),
    MANAGER_IS_EXIST(10010, "该地区已有管理"),
    REGION_MANAGER_IS_EXIST(10011, "该大区已有管理"),
    ROLE_NOT_FIND(10012, "用户角色未找到"),
    TAX_HOUSEHOLDS_IS_EXIST(10013, "该地区已有税户"),
    REGION_NOT_TAX_HOUSEHOLDS(10014, "大区没有税户"),
    ROLE_ALREADY_LOSE_EFFICACY(10015, "角色已停用"),
    ROLE_ALREADY_EFFICACY(10016, "角色已生效"),
    REGION_ALREADY_CLOSE(10017, "大区关闭成功"),
    REGION_ALREADY_RESTART(10018, "大区重启成功"),
    USER_VIP_NOT_EXIST(10019, "未开通会员"),
    USER_NO_ROLE(10020, "用户错误"),

    //自11000后为订单模块错误码
    PRODUCT_DATA_ERROR(11000, "商品库存不足"),
    ECARD_RECODE_ERROR(11001, "支付密码错误，请重新输入或者修改支付密码"),
    SELECT_ECARD_PWD_ERROR(11002, "未查询到该一卡通账户信息"),
    ECARD_FEE_ERROR(11003, "您的一卡通账户余额不足"),
    ORDER_FLAG_ERROR(11004, "该订单非支付完成状态，商户不能点击出发"),
    ORDER_INEXISTENCE_ERROR(11005, "该信息不存在或已删除"),
    ORDER_COMMERCIALTENANT_USER_ERROR(11006, "请用接单用户绑定账号进行操作"),
    ORDER_CO_ERROR(11007, "该订单非已出发状态，商户不能点击确认到达操作"),
    ORDER_USERID_ERROR(11008, "该订单非商户未确认到达，用户不能点击确认到达操作"),
    ORDER_USER_ERROR(11009, "该用户无权确认商户到达，请用下单用户进行确认操作"),
    ORDER_COMMERCIALTENANT_ERROR(11010, "该用户无权限完成该订单，请用接单用户进行完成操作"),
    ORDER_SURE_ERROR(11011, "该订单非用户已确认到达状态，不能点击完成操作"),
    ORDER_STORE_SURE_ERROR(11012, "该订单非商户已确认完成状态，不能点击确认完成操作"),
    ORDER_USER_EQUAL_ERROR(11013, "该订单的支付人信息与卡信息对应不上，请查证后支付"),
    ORDER_COMPAY_EQUAL_ERROR(11014, "公司账面上余额不足支付，请联系运营人员"),
    ORDER_DATE_EXIST_ERROR(11015, "该记录已存在，不允许添加，仅允许修改"),
    INTEGRAL_RATE_ERROR(11016, "积分占比必填，请管理员后台设置相关信息"),
    RATE_COUNT_ERROR(11017, "平台及各模块占比总和为100%"),
    RATE_EXIT_ERROR(11018, "已存在该业务模块的配置"),
    ORDER_CANCEL_ERROR(11019, "该订单状态，不能取消"),
    ORDER_PAY_ERROR(11020, "该订单状态，不能支付"),
    SHOPPING_CARD_PAY_ERROR(11021, "该商品已存在购物车内，不能重复添加"),
    SHOPPING_INSERT_PAY_ERROR(11022, "请勿重复下单"),
    PRODUCT_PAST_DATA_ERROR(11023, "该商品已下架,无法加入购物车"),
    PRODUCT_REAL_NAME_AUTH_ERROR(11024, "购买商品前,请先进行实名制认证"),
    PRODUCT_QUOTA_NUM_ERROR(11025, "您购买的商品超过限额"),
    PRODUCT_QUOTA_ADDRESS_ERROR(11026, "您购买的商品限制售卖地区"),
    PRODUCT_QUOTA_DATA_ERROR(11027, "限购数据以存在"),
    PRODUCT_EXCEL_FILENAME_ERROR(11028, "EXCEL文件名不规范"),
    ECARD_PAY_ERROR(11029, "该订单正在支付中，请稍后重试或联系管理员"),
    SELECT_ACCOUNT_ORDER(11030, "请选择结算订单"),
    SHOPPING_CAR_ERROR(11031, "未查到该条购物车信息，请查正"),
    ROB_ORDER_OK(11032, "抢单成功"),
    ROB_ORDER_ON(11033, "抢单失败"),
    PRODUCT_SOURCE_ORDER_ON(11034, "请传入商品所属模块"),
    NOTFOUND_ECARD_PASSWORD(11035, "该用户尚未设置支付密码，请设置"),
    ECARD_RECODE_MERCHANT_ERROR(11036, "支付密码错误，请重新输入或者去利万嘉app修改支付密码"),

    //自12000后为超市模块错误码
    MARKET_CATEGORY_USED(12000, "该品类下存在商户不允许删除"),
    MARKET_CATEGORY_EXIT(12001, "该品类已存在不允许重复添加"),
    MARKET_CATEGORY_INEXISTENCE(12002, "未查到该商品品类"),
    MARKET_MRECLASS_EXIT(12003, "该分类已存在不允许重复添加"),
    MARKET_MRECLASS_INEXISTENCE(12004, "未查到该商品分类"),
    MARKET_MRECLASS_USED(12005, "该分类正在使用不允许删除"),
    MARKET_MRECHANT_NOT_FIND(12006, "未查询到该分类"),
    MARKET_MRECHANT_PRODUCT_NOT_FIND(12007, "该未查询超市该商品"),
    REPLENISHMENT_TIME_ERROR(12008, "超市补货时间必须整点"),
    FEERATIO_ERROR(12009, "服务费比例必须在0和1之间"),
    VILLAGE_ERROR(12010, "该地区不是村级服务区，请查证"),
    BEYOND_SCOP_OF_DELIVERY_ERROR(12011, "超出配送范围"),
    CASH_REGISTER_BARCODE_ERROR(12012, "条形码错误，请查证后重试"),
    MERCHANT_ERROR(12013, "请等待审核通过再次编辑"),
    MERCHANT_NOT_FOUND_ERROR(12014, "未查询到该商户信息"),
    APPLY_MERCHANT_NOT_FOUND_ERROR(12015, "未查询到该商户申请信息"),
    CHARGING_RULES_ERROR(12016, "该收费规则已存在不允许重复添加"),
    NO_DELIVERY_AREA_ERROR(12017, "当前地址不在商家发货区域内"),
    MERCHANT_UNEND_AREACODE_EXIT_ERROR(12018, "该商户不允许配送区域已存在不允许重复添加"),
    CASH_MISMATCHING(12019, "收银机所属超市与账号不匹配"),

    //自13000后为星级会员模块错误码
    NOTFOUND_SYSSTARLEVEL_ERROR(13000, "未查询到该项会员星级"),
    NOTFOUND_STARPRIVILEGE_ERROR(13001, "未查询到该项星级特权"),
    STARPRIVILEGE_DESCRIBE_ERROR(13002, "特权类型为自定义时，特权描述不能为空"),
    SYS_NOTFOUND_STARPRIVILEGE_ERROR(13003, "系统未设置会员特权"),
    USER_STARPRIVILEGE_ERROR(13004, "该会员已经是当前等级，无须重新购买"),
    MORE_STARPRIVILEGE_ERROR(13005, "该会员等级无法降级购买"),
    NOT_RENEW_STARPRIVILEGE_ERROR(13006, "尚未购买过会员特权，不能进行升级/续费操作"),
    PAYMENT_NOT_SUPPORTED_ERROR(13007, "目前只支持微信/支付宝/一卡通方式支付"),
    DELETE_MEMBER_RELATION_ERROR(13008, "已关联会员不允许删除"),
    NOT_FOUND_STAR_RElATION_ERROR(13009, "尚未查询到该用户的星级会员购买订单相关信息"),
    PAY_FAIL_ERROR(13010, "一卡通支付失败"),
    EXIST_STAR_PRIVILEGE_ERROR(13011, "该会员特权已存在，不允许重复添加"),
    PAYTYPE_STAR_PRIVILEGE_ERROR(13012, "一卡通支付时，密码不允许为空"),

    //自14000后为物流模块错误码
    NOT_FOUND_ORDER_DISDISTRIBUTE_ERROR(14000, "订单不存在，请检查订单！"),
    NOT_FOUND_DISTRIBUTENUM_ORDERID_ERROR(14001, "物流单号和物流id必须选一个"),
    NOT_FOUND_ROUTE_ERROR(14002, "该配送员不在配送范围内"),
    NOTICE_USERTYPE_ROUTE_ERROR(14003, "目前只有配送员查看公告"),
    NO_DELIVERER(14004, "目前只有配送员查看公告"),
    ORDER_RETURN_ERROR(14005, "订单已退货"),
    ROUTE_IN_USE(14006, "该路线已被配送"),
    NOT_FOUND_DISDISTRIBUTE_ERROR(14007, "物流订单不存在或该状态不正确，请检查订单！"),
    NOT_FOUND_DISER_ERROR(14008, "未查到配送员用户信息"),

    ;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private int code;
    private String message;
    private ApiResponse apiResponse;

    public void setApiResponse(ApiResponse apiResponse) {
        this.code = apiResponse.getCode();
        this.message = apiResponse.getMsg();
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }


    public void setCode(int code) {
        this.code = code;
    }

    public ErrorCode setMessage(String message) {
        this.message = message;
        return this;
    }
}
